object NestedIfDemo extends App {
  val major: String = "计算机科学"
  val mathScore: Int = 90
  val gpa: Double = 3.2
  if (gpa >= 3.0) {
    if (major == "数学" || (major.contains("理工") && mathScore >= 85)) {
      println("符合数学竞赛报名条件")
    } else {
      println("不符合报名条件:专业不符且数学成绩不达标")
    }
  } else {
    println("不符合报名条件:绩点未达到3.0")
  }
   def checkEligibility(major: String,mathScore: Int, gpa: Double): String = {
     if (gpa >= 3.0){
       if (major == "数学" || (major.contains("理工") && mathScore >= 85)) {
         "符合条件"
       } else {
         "不符合:专业/数学成绩不达标"
       }
     }else {
       "不符合:绩点不足"
     }
   }
   println("\n不同学生的报名资格:")
   println(s"学生1(数学专业,绩点3.5) : ${checkEligibility("数学",80,3.5)}")
   println(s"学生2(文科专业,绩点3.2) : ${checkEligibility("中文",90,3.2)}")
   println(s"学生3(理工科,绩点2.8) : ${checkEligibility("电子工程",88,2.8)}")
}
